package Operation;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-12-31
 * Time: 22:13
 */
public class IsBorrowedOperation implements Operation{
    @Override
    public void work(BookList book) {
        System.out.println("请输入要借阅的书名");
        Scanner scanner=new Scanner(System.in);;
        String  name=scanner.nextLine();
        int size=book.getUsedSize();
        for (int i = 0; i < size; i++) {
            if(name.equals(book.getBook(i).getName())){
                book.getBook(i).setBorrowed(true);
                System.out.println("借阅成功");
                return;
            }
        }
        System.out.println("没有你要借阅的书");



    }
}
